#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui>
#include "highlighter.h"
#include "PlainEdit.h"
#include "Debugger.h"
#include "TabWidget.h"
#include "searchwindow.h"

extern "C"
{
#include "lua/lua.h"
#include "lua/lauxlib.h"
#include "lua/lualib.h"
};


class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
   // void instantOpen(const QString& flp); //for "rightklick->Open with.."
    static MainWindow* getWnd();
    static void Destroy();

private:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();
    static MainWindow* instance;
    QAbstractItemModel *modelFromFile(const QString& fileName);

    void setupMenu();
    void setupActions();
    void setupToolBar();

    void justOpen(const QString& flp);

    QCompleter *completer;
    TabWidget* tabWidget;
    PlainEdit* edit;
    Debugger* d;
    SearchWindow* w;
    lua_State* l;

    QMainWindow* wnd;
    QPushButton* b_colors;
    QLabel* l_sample;
    QComboBox* cb_colors;

    QToolBar* bar;

    QAction* Anew;
    QAction* AnewProj;
    QAction* Aopen;
    QAction* Asave;
    QAction* AsaveAs;
    QAction* Aprint;
    QAction* Aexit;
    QAction* Aundo;
    QAction* Aredo;
    QAction* Acut;
    QAction* Acopy;
    QAction* Apaste;
    QAction* Aselect;
    QAction* AgoTo;
    QAction* Afind;
    QAction* Aabout;
    QAction* AaddCurFile;
    QAction* Arun;
    QAction* Asettings;
    QAction* AaboutQt;
    QAction* test;

    QMenu* Mfile;
    QMenu* Medit;
    QMenu* Mproject;
    QMenu* Mrun;
    QMenu* Mview;
    QMenu* Mabout;

public slots:
    void instantOpen(const QString& flp);
private slots:
    void newf();
    void newProject();
    void open();
    void save();
    void saveAs();
    void print();
    void exit();
    void undo();
    void redo();
    void cut();
    void copy();
    void paste();
    void selectAll();
    void goTo();
    void find();
    void settings();
    void addCurrFile();
    void run();
    void about();
    void aboutQt();
    void runProj();
};

#endif // MAINWINDOW_H
